import {AccountInfo} from "@/types/AccountInfo";
import {ElMessage} from "element-plus";
import readXlsxFile from 'read-excel-file';
export const parseAccountFromFile = async (files, accounts: AccountInfo[]) => {
    const file = files.raw;
    if (file && file.type === 'text/plain') { // 确保文件是TXT类型
        const reader = new FileReader();
        reader.onload = async (e) => {
            const file = e.target.files[0];
            const rows = await readXlsxFile(file);
            console.log(rows);
        };
        reader.readAsText(file); // 读取文件内容
        return true;
    } else {
        ElMessage.error('请选择TXT文件');
        return false;
    }
}